using System.Drawing;
using Graphix.Elements;

namespace Graphix.Charts
{
    public class BubbleStyle
    {
        private float opacity;

        private Color borderColor;

        private float borderWidth;

        public BubbleStyle(Color borderColor, float borderWidth, TextStyle textStyle, float opacity = 1)
        {
            this.opacity = opacity;
            this.BorderColor = borderColor;
            this.BorderWidth = borderWidth;
            this.TextStyle = textStyle;
        }

        public BubbleStyle()
            : this(Color.LightGray, 1, null)
        {

        }

        public Pen Border { get; private set; }

        public Color BorderColor
        {
            get
            {
                return this.borderColor;
            }

            set
            {
                this.borderColor = value;
                this.Border = new Pen(this.BorderColor, this.BorderWidth);
            }
        }

        public float BorderWidth
        {
            get
            {
                return this.borderWidth;
            }
            set
            {
                this.borderWidth = value;
                this.Border = new Pen(this.BorderColor, this.BorderWidth);
            }
        }

        public float Opacity
        {
            get
            {
                return this.opacity;
            }

            set
            {
                if (value < 0)
                {
                    value = 0;
                }
                else if (value > 1)
                {
                    value = 1;
                }

                this.opacity = value;
            }
        }

        public TextStyle TextStyle { get; set; }
    }
}